package com.fjwt.gz.mch.ctrl.qa;

import cn.hutool.json.JSONUtil;
import com.fjwt.gz.core.constants.CS;
import com.fjwt.gz.core.model.ApiRes;
import com.fjwt.gz.db.vo.SysQaVO;
import com.fjwt.gz.mch.ctrl.CommonCtrl;
import com.fjwt.gz.service.impl.SysQaService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * 系统QA内容表 前端控制器
 * </p>
 *
 * @author zhangyangyang
 * @since 2025-05-15
 */
@Slf4j
@RestController
@RequestMapping("api/sysQa")
public class SysQaController extends CommonCtrl {

    @Autowired
    private SysQaService sysQaService;

    /**
     * 小程序QA内容列表
     */
    @PostMapping
    public ApiRes list() {
        List<SysQaVO> list = sysQaService.appletList(CS.SYS_ROLE_TYPE.MCH);
        log.info("C端QA内容列表，请求地址：/api/sysQa,返回结果：{}", JSONUtil.toJsonStr(list));
        List<SysQaVO> vos = List.copyOf(list);
        return ApiRes.ok(vos);
    }
}

